package com.xindaoapp.henghua.asset;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

public class DeviceAdapter extends PagerAdapter {
	private final DeviceWindow[] mDeviceWindows;

	public DeviceAdapter(DeviceWindow[] deviceWindows) {
		super();
		mDeviceWindows = deviceWindows;
	}

	@Override
	public int getCount() {
		return mDeviceWindows.length;
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView((View) object);
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		View view = mDeviceWindows[position].getView();
		container.addView(view);
		return view;
	}

}
